package com.demo.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerCollection {
    @Autowired
    private RestTemplate restTemplate;
    Logger log = LoggerFactory.getLogger(ConsumerCollection.class);
    @RequestMapping(value = "/",method = RequestMethod.GET)
    public String saySomething(){
        log.info("方法调用");
        return restTemplate.getForEntity("http://compute-service/",String.class).getBody();
    }
    @RequestMapping(value = "/hello/{name}",method = RequestMethod.GET)
    public String saySomething(@PathVariable String name){
        return restTemplate.getForEntity("http://compute-service/hello/"+name,String.class).getBody();
    }
}
